package com.ruoyi.project.system.house.house.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.house.house.enums.HouseDto;
import com.ruoyi.project.system.house.house.mapper.HouseMapper;
import com.ruoyi.project.system.house.house.domain.House;
import com.ruoyi.project.system.house.house.service.IHouseService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 房源信息Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-27
 */
@Service
public class HouseServiceImpl implements IHouseService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private HouseMapper houseMapper;

    /**
     * 查询房源信息
     * 
     * @param id 房源信息ID
     * @return 房源信息
     */
    @Override
    public HouseDto selectHouseById(String id)
    {
        return houseMapper.selectHouseById(id);
    }

    /**
     * 查询房源信息列表
     * 
     * @param house 房源信息
     * @return 房源信息
     */
    @Override
    public List<HouseDto> selectHouseList(House house)
    {
        return houseMapper.selectHouseList(house);
    }

    /**
     * 新增房源信息
     * 
     * @param house 房源信息
     * @return 结果
     */
    @Override
    public int insertHouse(House house)
    {
        house.setId(this.idGererateFactory.nextStringId());
        return houseMapper.insertHouse(house);
    }

    /**
     * 修改房源信息
     * 
     * @param house 房源信息
     * @return 结果
     */
    @Override
    public int updateHouse(House house)
    {
        return houseMapper.updateHouse(house);
    }

    /**
     * 删除房源信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHouseByIds(String ids)
    {
        return houseMapper.deleteHouseByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除房源信息信息
     * 
     * @param id 房源信息ID
     * @return 结果
     */
    @Override
    public int deleteHouseById(String id)
    {
        return houseMapper.deleteHouseById(id);
    }

    @Override
    public List<House> findByFile(String file) {
        return this.houseMapper.findByFile(file);
    }
}
